<template>
<div>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
    append-to-body
     v-dialogDrag
    :visible.sync="visible">
      <el-row  :gutter="15">
        <el-col :span="24">
            <el-form-item label="节点：" prop="type"
                :rules="[
                  {required: true, message:'节点不能为空', trigger:'blur'}
                 ]">
                 <el-radio-group v-model="inputForm.targetNode">
			            <el-radio style="display:block;"
			              v-for="item in this.hisFlowNodes"
			              :key="item.taskDefKey"
			              :value="item.taskDefKey"
			              :label="item.taskDefKey"
			              :disabled="item.formReadOnly"
			            >{{item.taskName}}</el-radio>
			          </el-radio-group>
	         </el-form-item>
        </el-col>
        </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
      <el-button type="primary" @click="doSubmit()" v-noMoreClick>确定</el-button>
    </span>
  </el-dialog>
</div>
</template>

<script>
  export default {
    data () {
      return {
        title: '',
        procInsId: '',
        taskId: '',
        visible: false,
        loading: false,
        hisFlowNodes: [],
        inputForm: {
          targetNode: ''
        }
      }
    },
    components: {
    },
    methods: {
      init (procInsId, taskId) {
        this.procInsId = procInsId
        this.taskId = taskId
        this.title = '选择退回到'
        this.visible = true
        this.loading = true
        this.$http({
          url: '/flowable/task/backforwardableList',
          method: 'get',
          params: {
            procInsId: this.procInsId,
            taskId: this.taskId
          }
        }).then(({data}) => {
          this.hisFlowNodes = data.hisFlowNodes
          this.loading = false
        })
      },
      // 表单提交
      doSubmit () {
        this.$emit('backforward', this.inputForm.targetNode)
        this.visible = false
      }
    }
  }
</script>